-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: remove interval and give more time to unsync #55006
Conversation
Review requested:
|
e6e0999
to
9daffe6
Compare
await new Promise((resolve) => setTimeout(() => { | ||
unlinkSync(fileToDeletePathLocal); | ||
resolve(); | ||
}, common.platformTimeout(1000))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can/Should this be simplified with node:timers/promises
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think about it, thanks for the suggestion, I'll take a look 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would using node:fs/promises
be enough here? It seems weird to have to put a sync operation in an async one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @aduh95, yes, no problem at all.
The only important logic is the "sleep" after the delete to ensure that the watcher has received the event and completed the test run before proceeding.
Thanks for your feedback, I'll fixit ASAP 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just update 😁
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #55006 +/- ##
==========================================
+ Coverage 88.04% 88.25% +0.20%
==========================================
Files 652 651 -1
Lines 183765 183877 +112
Branches 35863 35857 -6
==========================================
+ Hits 161789 162273 +484
+ Misses 15229 14898 -331
+ Partials 6747 6706 -41 |
140ae8d
to
48930c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some minor comments.
If this fixes #54807, can you add that to this PR so that the issue gets closed.
function wait(ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use setTimeout()
from node:timers/promises
for this exact functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This comment was marked as outdated.
This comment was marked as outdated.
I see this test fail a lot on windows platform, could we queue a stress test? |
Stress test CI: https://ci.nodejs.org/view/Stress/job/node-stress-single-test/538/ 🟢 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to use the flush
option of writeFile
to cause an fsync: https://nodejs.org/docs/latest/api/fs.html#fspromiseswritefilefile-data-options.
Landed in 02e8972 |
PR-URL: #55006 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jake Yuesong Li <[email protected]>
PR-URL: nodejs#55006 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jake Yuesong Li <[email protected]>
This PR should address #54807.
I'm leaving this in Draft while testing more extensively 🚀